package marmalius.player;

import marmalius.craft.GoalInfo;

public class GoalPoint {
	private int goalID;
	private int absX;
	private int absY;
	private GoalInfo goalInfo; //craft
	private GoalType type;
	
	public GoalPoint(int goalID, int absX, int absY, GoalType type, GoalInfo goalInfo) {
		this.goalID = goalID;
		this.absX = absX;
		this.absY = absY;
		this.type = type;
		this.goalInfo = goalInfo;
	}
	
	public boolean updateGoalInfo(int time) {
		if (goalInfo != null) {
			if (goalInfo.getMakeTime() - time >= 0) {
				goalInfo.setMakeTime(goalInfo.getMakeTime() - time);
				return false;
			}
			else {
				goalInfo.setMakeTime(0);
				return true;
			}
		}
		return false;
	}
	
	public int getGoalID() { return goalID; }
	public int getAbsX() { return absX; }
	public int getAbsY() { return absY; }
	public GoalType getType() { return type; }
	public GoalInfo getGoalInfo() { return goalInfo; }
}
